package chp12.home;

public class Home1 {

    public static void main(String[] args) {
        //找出数组最大值
        int[] nums = {34,63,2,56,22};
        System.out.println(nums);
        int max = findMaxValue(nums);

        System.out.println("数组的最大值:" + max);
    }

    public static int findMaxValue(int[] arr) {
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
        }
        return max;
    }
}
